<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function shui(n) {
				var s = 0;
				if (n > 0) {
					if (n > 3500 && n <= 8000) {
						s = ((n - 3500) * 0.02);
					} else if (n >8000 && n < 20000) {
						s = (8000 - 3500) * 0.02 + (20000 - n) * 0.05;
					} else if (n >=20000) {
						s = (8000 - 3500) * 0.02 + (20000 - 8000) * 0.05 + (20000 - n) * 0.1;
					}
				} else {
					alert("输入错误");
				}
				alert(s);
			}
		</script>
	</head>
	<body>
		<input type="button" value="计算" onclick="shui(prompt('请输入工资'))" />
	</body>
</html>
